# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'newAccount.ui'
#
# Created: Tue Jun 19 23:32:51 2012
#      by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

import pyodbc

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    _fromUtf8 = lambda s: s

class Ui_Form(QtGui.QWidget):
    
    def createAccount(self):
        self.login = self.loginlineEdit.text()
        self.haslo = self.passLineEdit.text()
        
        conn = pyodbc.connect(self.databaseDir)
        cur = conn.cursor()
        cur.execute("exec addUser ?, ?, ?, ?",str(self.login),str(self.haslo),"question","answer")
        conn.commit()
        conn.close()
        
        self.Form.close()
        
        
    
    def setupUi(self, Form, databaseDir, BudgetAnalizer):
        self.BudgetAnalizer = BudgetAnalizer
        self.databaseDir = databaseDir
        self.Form = Form
        self.Form.setObjectName(_fromUtf8("Form"))
        self.Form.resize(400, 300)
        self.passLabel = QtGui.QLabel(self.Form)
        self.passLabel.setGeometry(QtCore.QRect(50, 130, 46, 13))
        self.passLabel.setObjectName(_fromUtf8("passLabel"))
        self.loginButton = QtGui.QPushButton(Form)
        self.loginButton.setGeometry(QtCore.QRect(260, 100, 91, 30))
        self.loginButton.setMinimumSize(QtCore.QSize(30, 30))
        self.loginButton.setObjectName(_fromUtf8("loginButton"))
        self.passLineEdit = QtGui.QLineEdit(Form)
        self.passLineEdit.setGeometry(QtCore.QRect(110, 120, 113, 20))
        self.passLineEdit.setObjectName(_fromUtf8("passLineEdit"))
        self.loginLabel = QtGui.QLabel(Form)
        self.loginLabel.setGeometry(QtCore.QRect(50, 100, 46, 13))
        self.loginLabel.setObjectName(_fromUtf8("loginLabel"))
        self.loginlineEdit = QtGui.QLineEdit(Form)
        self.loginlineEdit.setGeometry(QtCore.QRect(110, 100, 113, 20))
        self.loginlineEdit.setObjectName(_fromUtf8("loginlineEdit"))
        self.loginButton.connect(self.loginButton, QtCore.SIGNAL("clicked()"), self.createAccount)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        Form.setWindowTitle(QtGui.QApplication.translate("Form", "Form", None, QtGui.QApplication.UnicodeUTF8))
        self.passLabel.setText(QtGui.QApplication.translate("Form", "Haslo:", None, QtGui.QApplication.UnicodeUTF8))
        self.loginButton.setText(QtGui.QApplication.translate("Form", "Utworz", None, QtGui.QApplication.UnicodeUTF8))
        self.loginLabel.setText(QtGui.QApplication.translate("Form", "Login:", None, QtGui.QApplication.UnicodeUTF8))

